package com.woniu.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.woniu.entity.dto.SearchTrainingDTO;
import com.woniu.entity.dto.TrainingDTO;
import com.woniu.entity.vo.TrainingVO;
import com.woniu.pojo.Training;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author xiaosong
 * @since 2023-03-31
 */
@Mapper
public interface TrainingMapper extends BaseMapper<Training> {
    @Update("update wnsys_training set is_vip =${isVip} where id=${id}")
    Boolean switchVIP(Integer id, Integer isVip);

//    Boolean checkCollect(Integer id);

    List<TrainingVO> showFollow(Integer uid);

    Set<TrainingVO> showRecommend();

    IPage<TrainingVO>  searchBar(IPage<TrainingVO> page, @Param("searchTrainingDTO") SearchTrainingDTO searchTrainingDTO);

    ArrayList<String> showParent();

    List<TrainingVO> selectAll(@Param("trainingDto") TrainingDTO trainingDto);

    Integer getParentId(String pName);

    Integer checkCollect(@Param("uid") Integer uid,@Param("title") String title);
}
